package com.deluxelx.rmo.user.listener;

import com.deluxelx.rmo.common.constants.MqConstants;
import com.deluxelx.rmo.common.message.UserSentimentMes;
import com.deluxelx.rmo.user.api.SentimentService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class UserSentimentListener {

    @Resource
    private SentimentService sentimentService;

    @RabbitListener(queues = MqConstants.SENTIMENT_QUEUE)
    public void changeUserSentiment(UserSentimentMes sentimentMes) {
        sentimentService.calculateSentiment(sentimentMes);
    }

}
